<!--主内容区展示组件-->

<script lang="ts">
import {Vue, Component, Prop, Inject, Watch} from 'vue-property-decorator';
import {displayType, MainDisplayProps} from "./types";
import ImgPreview from "./ImgPreview.vue";
import InfoPreview from "./InfoPreview.vue";
import {BusinessType, BusinessTypeEnum} from "../../type";
import {
  BrandDetail,
  CommodityDetail,
  CommodityLicenseDetail,
  CommodityReviewItem,
  PartnerLicenseDetail
} from "../../plugins/dto";
import {fieldProps} from "./InfoPreview";
@Component({components:{ImgPreview, InfoPreview}})
export default class MainDisplay extends Vue implements MainDisplayProps{
  @Prop({default: ""}) title!: string;
  @Prop({default: ""}) displayType!: displayType;

  @Inject("ApplyInfo")
  providedApplyInfo!:any

  fieldsListMap = {
    "commodity": [
      {
        name: "标准商品编码",
        key: "standardCode",
        value: "",
        render: "",
        editable: false,
        labelKey: "",
        multiple: false,
      },
      {
        name: "商品名称",
        key: "cnName",
        value: "",
        render: "",
        editable: true,
        labelKey: "",
        multiple: false
      },
      {
        name: "规格型号",
        key: "specification",
        value: "",
        editable: true,
        labelKey: "",
        render: "",
        multiple: false
      },
      {
        name: "品牌",
        key: "brandStandardCode",
        value: "",
        editable: false,
        render: "BrandSelect",
        labelKey: "brandName",
        multiple: false
      },
      {
        name: "基本单位",
        key: "minSaleUnit",
        value: "",
        editable: true,
        render: "UnitSelect",
        labelKey: "minSaleUnitName",
        multiple: false
      },
      {
        name: "包装参数",
        key: "packageParam",
        value: "",
        editable: true,
        labelKey: "",
        render: "",
        multiple: false
      },
      {
        name: "证照编号",
        key: "licenses",
        value: "",
        editable: true,
        labelKey: "licenseCode",
        render: "LicenseSelect",
        multiple: true
      },
      {
        name: "管理类别",
        key: "managementCategory",
        value: "",
        editable: false,
        labelKey: "managementCategoryName",
        render: "ManageCategory",
        multiple: false
      },
      {
        name: "货号",
        key: "articleNo",
        value: "",
        editable: true,
        labelKey: "",
        render: "",
        multiple: false
      },
      {
        name: "商品类型",
        key: "commodityTypeName",
        value: "",
        editable: false,
        labelKey: "",
        render: "",
        multiple: false
      }
    ],
    "brand": [
        {
      name: "品牌图片",
      key: "logo",
      value: "https://official-data.oss-cn-shanghai.aliyuncs.com/mdm/base/no_image.png",
      editable: false,
      render: "image",
      labelKey: "",
      multiple: false
    },
        {
        name: "品牌名称",
        key: "cnName",
        value: "",
        editable: false,
        render: "",
        labelKey: "",
        multiple: false
      },
        {
        name: "英文名称",
        key: "enName",
        value: "",
        editable: true,
        render: "",
        labelKey: "",
        multiple: false
      },
        {
        name: "品牌所属公司",
        key: "companyName",
        value: "",
        editable: true,
        render: "",
        labelKey: "",
        multiple: false
      }
    ],
    "registration": [
        {
        name: "证照编号",
        key: "licenseCode",
        value: "",
        editable: false,
        render: "",
        labelKey: "",
        multiple: false
      },
      {
        name: "证照类型",
        key: "licenseTypeName",
        value: "",
        editable: false,
        render: "",
        labelKey: "",
          multiple: false
      },
      {
        name: "批准日期",
        key: "effDate",
        value: "",
        editable: false,
        render: "",
        labelKey: "",
          multiple: false
      },
      {
        name: "审批部门",
        key: "approvalDepartment",
        value: "",
        editable: false,
        render: "",
        labelKey: "",
          multiple: false
      },
      {
        name: "有效期至",
        key: "periodValidity",
        value: "",
        editable: false,
        render: "",
        labelKey: "",
          multiple: false
      },
      {
        name: "注册人名称",
        key: "licenseName",
        value: "",
        editable: false,
        render: "",
        labelKey: "",
          multiple: false
      },
      {
        name: "管理类别",
        key: "managementCategory",
        value: "",
        editable: false,
        render: "ManageCategory",
        labelKey: "managementCategoryName",
          multiple: false
      },
      {
        name: "注册人住所",
        key: "licenseAddress",
        value: "",
        editable: false,
        render: "",
        labelKey: "",
          multiple: false
      },
      {
        name: "产品名称",
        key: "productName",
        value: "",
        editable: false,
        render: "",
        labelKey: "",
          multiple: false
      },
      {
        name: "规格型号",
        key: "specification",
        value: "",
        editable: false,
        render: "",
        labelKey: "",
          multiple: false
      },
      {
        name: "规格及组成",
        key: "commodityCode",
        value: "",
        editable: false,
        render: "",
        labelKey: "",
          multiple: false
      },
      {
        name: "使用范围",
        key: "commodityCode",
        value: "",
        editable: false,
        render: "",
        labelKey: "",
          multiple: false
      },
      {
        name: "变更情况",
        key: "changes",
        value: "",
        editable: false,
        render: "",
        labelKey: "",
          multiple: false
      },
      {
        name: "其他内容",
        key: "other_contents",
        value: "",
        editable: false,
        render: "",
        labelKey: "",
          multiple: false
      },
      {
        name: "生产地址",
        key: "productionAddress",
        value: "",
        editable: false,
        render: "",
        labelKey: "",
          multiple: false
      },
      {
        name: "代理人名称",
        key: "agentName",
        value: "",
        editable: false,
        render: "",
        labelKey: "",
          multiple: false
      },
      {
        name: "代理人住所",
        key: "agentAddress",
        value: "",
        editable: false,
        render: "",
        labelKey: "",
          multiple: false
      },
      {
        name: "备注",
        key: "comment",
        value: "",
        editable: false,
        render: "",
        labelKey: "",
          multiple: false
      },
    ],
    partnerLicense: [
      {
        "key": "licenseCode",
        "name": "许可证号",
        "value": "",
        "editable": false,
        "render": "",
        "labelKey": "",
        "multiple": false
      },
      {
        "key": "companyName",
        "name": "单位名称",
        "value": "",
        "editable": false,
        "render": "",
        "labelKey": "",
        "multiple": false
      },
      {
        "key": "warehouseAddress",
        "name": "注册地址",
        "value": "",
        "editable": false,
        "render": "",
        "labelKey": "",
        "multiple": false
      },
      {
        "key": "disinfectionLicenseName",
        "name": "许可证名称",
        "value": "",
        "editable": false,
        "render": "",
        "labelKey": "",
        "multiple": false
      },
      {
        "key": "businessPremises",
        "name": "生产地址",
        "value": "",
        "editable": false,
        "render": "",
        "labelKey": "",
        "multiple": false
      },

      {
        "key": "legalPerson",
        "name": "法定代表人",
        "value": "",
        "editable": false,
        "render": "",
        "labelKey": "",
        "multiple": false
      },
      {
        "key": "administrativeDivision",
        "name": "行政区划",
        "value": "",
        "editable": false,
        "render": "",
        "labelKey": "",
        "multiple": false
      },
      {
        "key": "licenseHandleDate",
        "name": "办理日期",
        "value": "",
        "editable": false,
        "render": "",
        "labelKey": "",
        "multiple": false
      },
      {
        "key": "businessDateStart",
        "name": "开始日期",
        "value": "",
        "editable": false,
        "render": "",
        "labelKey": "",
        "multiple": false
      },
      {
        "key": "validityPeriod",
        "name": "截止日期",
        "value": "",
        "editable": false,
        "render": "",
        "labelKey": "",
        "multiple": false
      },
      {
        "key": "specificationInAnnex",
        "name": "附件中规格",
        "value": "",
        "editable": false,
        "render": "",
        "labelKey": "",
        "multiple": false
      }
    ],
    commodityLicense: [
      {
        "key": "licenseCode",
        "name": "注册证编号",
        "value": "",
        "editable": false,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "licenseTypeName",
        "name": "证照类型",
        "value": "",
        "editable": false,
        "render": "",
        "labelKey": "",
        "multiple": false,
      },
      {
        "key": "managementCategory",
        "name": "管理类别",
        "value": "",
        "editable": true,
        "render": "ManageCategory",
        "multiple": false,
        labelKey: "managementCategoryName",
      },
      {
        "key": "licenseName",
        "name": "注册人名称",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "licenseAddress",
        "name": "注册人住所",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "productionAddress",
        "name": "生产地址",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "productName",
        "name": "产品名称",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "approvalDate",
        "name": "批准日期",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "effDate",
        "name": "生效日期",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "periodValidity",
        "name": "有效期至",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "specification",
        "name": "型号规格",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "productDescription",
        "name": "结构及组成",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "expectPurpose",
        "name": "适用范围",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "storageConditions",
        "name": "储存条件",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "annex",
        "name": "附件",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "otherContents",
        "name": "其他内容",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "comment",
        "name": "备注",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "approvalDepartment",
        "name": "审批部门",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },

      {
        "key": "changes",
        "name": "变更情况",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "specificationInAnnex",
        "name": "附件中规格",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      }
    ],
    foreignLicense: [
      {
        "key": "licenseCode",
        "name": "注册证编号",
        "value": "",
        "editable": false,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "licenseTypeName",
        "name": "证照类型",
        "value": "",
        "editable": false,
        "render": "",
        "labelKey": "",
        "multiple": false,
      },
      {
        "key": "managementCategory",
        "name": "管理类别",
        "value": "",
        "editable": true,
        "render": "ManageCategory",
        "multiple": false,
        labelKey: "managementCategoryName",
      },
      {
        "key": "licenseName",
        "name": "注册人名称",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "licenseAddress",
        "name": "注册人住所",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "productionAddress",
        "name": "生产地址",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "agentName",
        "name": "代理人名称",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "agentAddress",
        "name": "代理人住所",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "productName",
        "name": "产品名称",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "approvalDate",
        "name": "批准日期",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "effDate",
        "name": "生效日期",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "periodValidity",
        "name": "有效期至",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "specification",
        "name": "型号规格",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "productDescription",
        "name": "结构及组成",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "expectPurpose",
        "name": "适用范围",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "storageConditions",
        "name": "储存条件",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "annex",
        "name": "附件",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "otherContents",
        "name": "其他内容",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "comment",
        "name": "备注",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "approvalDepartment",
        "name": "审批部门",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },

      {
        "key": "changes",
        "name": "变更情况",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "specificationInAnnex",
        "name": "附件中规格",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      }
    ],
    domesticRecord: [
      {
        "key": "licenseCode",
        "name": "备案号",
        "value": "",
        "editable": false,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "licenseTypeName",
        "name": "证照类型",
        "value": "",
        "editable": false,
        "render": "",
        "labelKey": "",
        "multiple": false
      },
      {
        "key": "managementCategory",
        "name": "管理类别",
        "value": "",
        "editable": true,
        "render": "ManageCategory",
        "multiple": false,
        labelKey: "managementCategoryName",
      },
      {
        "key": "licenseName",
        "name": "备案人名称",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "licenseAddress",
        "name": "备案人住所",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "productionAddress",
        "name": "生产地址",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "productName",
        "name": "产品名称",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "approvalDate",
        "name": "备案日期",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "specification",
        "name": "型号规格",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "productDescription",
        "name": "产品描述",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "expectPurpose",
        "name": "预期用途",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "storageConditions",
        "name": "储存条件",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "comment",
        "name": "备注",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "approvalDepartment",
        "name": "备案单位",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },

      {
        "key": "changes",
        "name": "变更情况",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "specificationInAnnex",
        "name": "附件中规格",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      }
    ],
    foreignRecord: [
      {
        "key": "licenseCode",
        "name": "备案号",
        "value": "",
        "editable": false,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "licenseTypeName",
        "name": "证照类型",
        "value": "",
        "editable": false,
        "render": "",
        "labelKey": "",
        "multiple": false
      },
      {
        "key": "managementCategory",
        "name": "管理类别",
        "value": "",
        "editable": true,
        "render": "ManageCategory",
        "multiple": false,
        labelKey: "managementCategoryName",
      },
      {
        "key": "licenseName",
        "name": "备案人名称",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "licenseAddress",
        "name": "备案人住所",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "productionAddress",
        "name": "生产地址",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "agentName",
        "name": "代理人名称",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "agentAddress",
        "name": "代理人住所",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "productName",
        "name": "产品名称",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "approvalDate",
        "name": "备案日期",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "specification",
        "name": "型号规格",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "productDescription",
        "name": "产品描述",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "expectPurpose",
        "name": "预期用途",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "storageConditions",
        "name": "储存条件",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "comment",
        "name": "备注",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "approvalDepartment",
        "name": "备案单位",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },

      {
        "key": "changes",
        "name": "变更情况",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      },
      {
        "key": "specificationInAnnex",
        "name": "附件中规格",
        "value": "",
        "editable": true,
        "render": "",
        "multiple": false,
        labelKey: "",
      }
    ]
  }
  commodityReviewData:{[key:string]: any} = {}
  brandReviewData:{[key:string]: any} = {}
  commodityLicenseReviewData:{[key:string]: any} = {}
  partnerLicenseReviewData:{[key:string]: any} = {}
  @Inject("businessType")
  providedBusinessType!:BusinessType

  @Inject("CommodityDetail")
  providedCommodityDetail!:CommodityDetail;

  @Inject("BrandDetail")
  providedBrandDetail!:BrandDetail

  @Inject("CommodityLicenseDetail")
  providedCommodityLicenseDetail!:CommodityLicenseDetail

  @Inject("PartnerLicenseDetail")
  providedPartnerLicenseDetail!:PartnerLicenseDetail

  @Watch("providedApplyInfo", {deep: true, immediate: true})
  handleApplyInfo(data:any){
    if(data.batchApplyNo){
      if(data.batchApplyType === 'edit_name'){
        this.fieldsListMap.commodity.forEach((item:any) => {
          if(item.key!=='cnName'){
            item.editable = false
          }
        })
      }else if(data.batchApplyType === 'edit_reg'){
        this.fieldsListMap.commodity.forEach((item:any) => {
          if(item.key!=='licenses'){
            item.editable = false
          }
        })
      }
    }
  }

  @Watch("providedCommodityDetail", {immediate: true, deep: true})
  commodityDetailChange(value:CommodityDetail, old:CommodityDetail){
    console.log(1, value, old)
    if(value.commodityType == 9){
      this.fieldsListMap.commodity[6].editable = false
    }
    if(this.providedBusinessType.businessType==="commodity"){
      this.fieldsListMap[this.providedBusinessType.businessType] = this.fieldsListMap[this.providedBusinessType.businessType].map(item => {
        item.value = <string>this.providedCommodityDetail[item.key as keyof CommodityDetail];
        if(item.labelKey && !item.multiple){
          //@ts-ignore
          item[item.labelKey as keyof fieldProps] = this.providedCommodityDetail[item.labelKey as keyof typeof this.providedCommodityDetail];
        }else if(item.labelKey &&　item.multiple){
          //@ts-ignore
          item[item.key as keyof fieldProps] = this.providedCommodityDetail[item.key as keyof typeof this.providedCommodityDetail]
        }
        this.commodityReviewData[item.key as keyof CommodityReviewItem] = this.providedCommodityDetail[item.key as keyof CommodityDetail] as any;
        if(item.render === 'image' && !item.value){
          item.value = "https://official-data.oss-cn-shanghai.aliyuncs.com/mdm/base/no_image.png"
        }
        return item
      })

      this.commodityReviewData["id"] = this.providedCommodityDetail["id"]
      this.commodityReviewData["tagPicture"] = this.providedCommodityDetail["tagPicture"]
      this.commodityReviewData["brandStandardCode"] = this.providedCommodityDetail["brandStandardCode"]
    }
  }

  @Watch("providedBrandDetail", {immediate: true, deep: true})
  brandDetailChange(value:BrandDetail, old:BrandDetail){
    console.log(2, value, old)
    if(this.providedBusinessType.businessType==="brand"){
      this.fieldsListMap[this.providedBusinessType.businessType] = this.fieldsListMap[this.providedBusinessType.businessType].map(item => {
        item.value = <string>this.providedBrandDetail[item.key as keyof BrandDetail];
        if(item.labelKey && !item.multiple){
          //@ts-ignore
          item[item.labelKey as keyof fieldProps] = this.providedBrandDetail[item.labelKey as keyof typeof this.BrandDetail];
        }else if(item.labelKey &&　item.multiple){
          //@ts-ignore
          item[item.key as keyof fieldProps] = this.providedBrandDetail[item.key as keyof typeof this.BrandDetail]
        }
        this.brandReviewData[item.key as keyof BrandDetail] = this.providedBrandDetail[item.key as keyof BrandDetail] as any;
        return item
      })
      this.brandReviewData["tagPicture"] = this.providedBrandDetail["commodityPicture"]
    }
  }

  @Watch("providedCommodityLicenseDetail", {immediate: true, deep: true})
  commodityLicenseDetailChange(value:CommodityLicenseDetail,old:CommodityLicenseDetail){
    console.log(3, value, old)
    if(["commodityLicense", "foreignLicense" , "domesticRecord" , "foreignRecord"].includes(this.providedBusinessType.businessType)){
      this.fieldsListMap[this.providedBusinessType.businessType] = this.fieldsListMap[this.providedBusinessType.businessType].map(item => {
        item.value = <string>this.providedCommodityLicenseDetail[item.key as keyof CommodityLicenseDetail];
        if(item.labelKey && !item.multiple){
          //@ts-ignore
          item[item.labelKey as keyof fieldProps] = this.providedCommodityLicenseDetail[item.labelKey as keyof typeof this.BrandDetail];
        }else if(item.labelKey &&　item.multiple){
          //@ts-ignore
          item[item.key as keyof fieldProps] = this.providedCommodityLicenseDetail[item.key as keyof typeof this.BrandDetail]
        }
        this.commodityLicenseReviewData[item.key as keyof CommodityLicenseDetail] = this.providedCommodityLicenseDetail[item.key as keyof CommodityLicenseDetail] as any;

        return item
      })
      this.commodityLicenseReviewData["picture"] = this.providedCommodityLicenseDetail["picture"]
    }
  }

  @Watch("providedPartnerLicenseDetail", {immediate: true, deep: true})
  partnerLicenseDetailChange(value:PartnerLicenseDetail, old:PartnerLicenseDetail){
    console.log(4, value, old, this.providedBusinessType.businessType)
    if(this.providedBusinessType.businessType==="partnerLicense"){
      this.fieldsListMap[this.providedBusinessType.businessType] = this.fieldsListMap[this.providedBusinessType.businessType].map(item => {
        item.value = <string>this.providedPartnerLicenseDetail[item.key as keyof PartnerLicenseDetail];
        if(item.labelKey && !item.multiple){
          //@ts-ignore
          item[item.labelKey as keyof fieldProps] = this.providedPartnerLicenseDetail[item.labelKey as keyof typeof this.BrandDetail];
        }else if(item.labelKey &&　item.multiple){
          //@ts-ignore
          item[item.key as keyof fieldProps] = this.providedPartnerLicenseDetail[item.key as keyof typeof this.BrandDetail]
        }
        this.partnerLicenseReviewData[item.key as keyof PartnerLicenseDetail] = this.providedPartnerLicenseDetail[item.key as keyof PartnerLicenseDetail] as any;
        return item
      })
    }

  }

  get imageUrl(){
    if(this.providedBusinessType.businessType === "commodity"){
      return this.providedCommodityDetail.tagPicture || "https://official-data.oss-cn-shanghai.aliyuncs.com/mdm/base/no_image.png" as string;
    }
    if(this.providedBusinessType.businessType === "brand"){
      return this.providedBrandDetail.commodityPicture || "https://official-data.oss-cn-shanghai.aliyuncs.com/mdm/base/no_image.png" as string;
    }
    if(["commodityLicense", "foreignLicense" , "domesticRecord" , "foreignRecord"].includes(this.providedBusinessType.businessType)){
      return this.providedCommodityLicenseDetail.picture || "https://official-data.oss-cn-shanghai.aliyuncs.com/mdm/base/no_image.png" as string;
    }
    if(this.providedBusinessType.businessType === "partnerLicense"){
      return this.providedPartnerLicenseDetail.unitLicensePicture || "https://official-data.oss-cn-shanghai.aliyuncs.com/mdm/base/no_image.png" as string
    }
  }
  handleUpdate(data: { type: BusinessTypeEnum, data: fieldProps[] }){
    console.log(232323, data)
    if(data.type === 'commodity'){
      for(let item of data.data){
        this.commodityReviewData[item.key] = item.value
      }
    }else if(data.type === 'brand'){
      for(let item of data.data){
        this.brandReviewData[item.key] = item.value
      }
    }else if(data.type === 'commodityLicense'){
      for(let item of data.data){
        this.commodityLicenseReviewData[item.key] = item.value
      }
    }else if(data.type === 'partnerLicense'){
      for(let item of data.data){
        this.partnerLicenseReviewData[item.key] = item.value
      }
    }
  }
}
</script>

<template>
<div class="cc-main-display__wrapper">
  <div class="cc-main-display__header">
    
  </div>
  <div class="cc-main-display__content">
    <ImgPreview :url="imageUrl"></ImgPreview>
    <InfoPreview :fields-list="fieldsListMap[providedBusinessType.businessType]" @update="handleUpdate"></InfoPreview>
  </div>

</div>
</template>

<style scoped lang="scss">
.cc-main-display__wrapper{
  height: 100%;
}
.cc-main-display__content{
  height: calc(100% - 44px);
  display: flex;
}
.cc-main-display__header{
  height: 30px;
  line-height: 30px;
  padding: 6px 10px;
  text-align: left;
  font-weight: 700;
  box-sizing: content-box;
  border-bottom: 1px solid #f0f0f0;
}
::v-deep .viewer-backdrop{
  background: rgba(0, 0, 0, 0.3);
}
::v-deep .viewer-backdrop:before{
  background: #fff;
}
</style>